//
//  UIcolor+extension.swift
//  SchoolDemo
//
//  Created by rimi on 16/9/26.
//  Copyright © 2016年 YQ. All rights reserved.
//

import UIKit

extension UIColor {
    
    //将16进制颜色值转换为颜色对象 445577
    func colorWithHex(_ hexColor: uint) -> UIColor {
        //位操作运算获得对应的rgb颜色值
        let r:uint = hexColor >> 16 //0x44
        let g:uint = hexColor >> 8 & 0xFF //0x55
        let b:uint = hexColor & 0xFF //0x77
        return UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: 1.0)
    }
}
